package com.dongbo.recorder.screenrecord.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dongbo.recorder.screenrecord.R;
import com.dongbo.recorder.screenrecord.bean.EditVideoBean;

/**
 * @author GuoZi
 * @date :2020/5/6 21:07
 * @description:
 */
public class EditAdapter extends BaseQuickAdapter<EditVideoBean, BaseViewHolder> {
    private int choose = -1;

    public EditAdapter() {
        super(R.layout.adapter_edit);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, EditVideoBean data) {
        baseViewHolder.setText(R.id.edit_item,data.getName());
        if(choose == baseViewHolder.getLayoutPosition()){
            baseViewHolder.setBackgroundResource(R.id.edit_item,R.drawable.bg_edit_choose);
        }else{
            baseViewHolder.setBackgroundResource(R.id.edit_item,R.drawable.bg_edit_unchoose);
        }
    }

    public int getChoose() {
        return choose;
    }

    public void setChoose(int choose) {
        this.choose = choose;
        notifyDataSetChanged();
    }
}
